package me.ezitku.base.extensions

import android.content.Context
import android.view.View
import android.view.inputmethod.InputMethodManager

/**
 * Created by yurqi on 2017/5/18.
 * كونۇپكا تاختىسى
 */




fun View.showKeyBoard() {
    this.context.inputManager.showSoftInput(this, 0)
}

private val Context.inputManager: InputMethodManager
    get() = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager


// كونۇپكا تاختىسى ئۇچۇق بولسا يۇشۇرىدۇ يۇشۇرۇن ھالەتتە بولسا كۆرسىتىدۇ
fun Context.toggleKeyboard() {
    inputManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS)
}

//كونۇپكا تاختىسىنى يۇشۇرۇش
fun View.hideKeyboard() {
    this.context.inputManager.hideSoftInputFromWindow(applicationWindowToken, 0)
}
